Skip to content

RSA Cheat Sheet

Setup

p= random prime number

q= random prime number

n=pq

Φ(n)=(p1)(q1) (this is called the totient function)

e= some number smaller than Φ(n) that's coprime with it (shares no factors)

Calculate d with:

de=1modΦ(n)

Public key: n,e

Private key: p,q,d

m= message, c= ciphertext

Encryption

c=memodn

Decryption

m=cdmodn

Signing

s is signature

s=mdmodn

Verification

Verify by checking if se=m